<?php

namespace common\validate;

use think\Validate;

class TenantGroup extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data', 'require')
            ->append('data.name', 'require|max:20');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data', 'require')
            ->append('data.id', 'require|integer');
    }

    // transfer 验证场景定义
    public function sceneTransfer()
    {
        return $this->append('data', 'require')
            ->append('data.id', 'require|integer')
            ->append('data.tenant_id', 'require|integer');
    }

    // dissolve 验证场景定义
    public function sceneDissolve()
    {
        return $this->append('data', 'require')
            ->append('data.tenant_group_id', 'require|integer');
    }

    public function sceneSelectTenantGroupMemberSupplier()
    {
        return $this->append('para.filter.tenant_group_id', 'require');
    }

}
